using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class InventoryElements : MonoBehaviour
{
    public bool isFirstGet=true;
    public int number;
    public float CDMaskFill;
    
    public Text numberText;
    public Image CDMask;
    public Image icon;

    public void Start()
    {
        if (isFirstGet)
        {
            Color color = icon.color;
            color.a = 0;
            icon.color = color;
    
            CDMask.fillAmount = 0;
            
            numberText.text = "";
        }
    }

    public void GetItem(int curretItemNumber)
    {
        if (isFirstGet)
        {
            isFirstGet = false;
            
        }
        Color color = icon.color;
        color.a = 1;
        icon.color = color;
        number = curretItemNumber;
        numberText.text = number.ToString();
        
    }

    public void UseItem(int ItemCount)
    {
        number = ItemCount;
        numberText.text = number.ToString();
        CDMask.fillAmount = CDMaskFill;
        if (number == 0)
        {
            Color color = icon.color;
            color.a = 0.5f;
            icon.color = color;
            numberText.text = "";
        }
    }

    public void CoolDownItem(float CD)
    {
        CDMaskFill = CD;
        CDMask.fillAmount = CDMaskFill;
    }
}
